'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Todo extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
    }
  };
  Todo.init({
    name: DataTypes.STRING,
    deadline: DataTypes.DATE,
    content: DataTypes.STRING,
    /**
     * 0: 待办
     * 1：完成
     * -1：删除
     */
    status: {
      type: DataTypes.INTEGER,
      defaultValue: 0
    } 
  }, {
    sequelize,
    modelName: 'Todo',
    timestamps: false, // 默认不启用 createdAt，updatedAt
    //控制台报错 INSERT INTO `Todos` (`id`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?);
  });
  return Todo;
};
